//
//  CAnimationSystem.h
//  Monster_Martial_Arts_Version_0
//
//  Created by chiawei.tseng on 13/1/7.
//
//

#ifndef Monster_Martial_Arts_Version_0_CAnimationSystem_h
#define Monster_Martial_Arts_Version_0_CAnimationSystem_h

#include "AnimationDef.h"
#include "CActiveAnimation.h"
#include <map>

using namespace std;
using namespace MMA;

class CCallBack;
class CBattleObject;
class CCAnimationEventListener;
class CAnimationSystem
{
    friend class CActiveAnimation;
    friend class CAnimationEvent;
public:
    
    CAnimationSystem();
    ~CAnimationSystem();
    
    void Init(CBattleObject*);
    void Update(float dt);
    void Release();
    void LoadAnimation();
    
    void ChangeActiveAnimation(ACTIVE_ANIMATION_ID AnimationID);
    ACTIVE_ANIMATION_ID GetCurrActiveAnimationID();
    
    void AddCallBackFunction(ACTIVE_ANIMATION_ID,CCallBack*);
    
private:
    
    void    PlayeToMyMasterAnimation(const char*);
    
    void    UpdateMyMasterAnimation(float dt);
    
    void    RegisterAniEventListener(CCAnimationEventListener*);
        
    CBattleObject* m_MyMaster;
    
    map<int,CActiveAnimation*> m_mapAnaimations;
    
    int m_nPreActiveAnaimationID;
    int m_nCurrActiveAnimationID;
    int m_nNextActiveAnimationID;
};



#endif
